<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>layui</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" href="__CSS__/layui.css"  media="all">
	<link rel="stylesheet" type="text/css" href="__WEB__/css/style.css"/>
	<script src="__UI__/layui.js"></script>
	<script src="__PUBLIC__/js/jquery.js"></script>
	<!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<script>
	$(document).ready(function () {
		$('.layer_form .down_icon').bind('click', function () {
			$(this).toggleClass('on');
			$('.layer_form').toggleClass('auto')
		})
	})
</script>
<style>
	body,html {background: #f8f8f8;margin: 0 auto;}
	body,h1,h2,h3,h4,h5,h6,p,blockquote,pre,dl,dd,fieldset,form,input,select,textarea,figure,div,
	form,img,ul,ol,li,i,b,table,tr,td,th,fieldset,label,legend {margin: 0;padding: 0;box-sizing: content-box;outline: none;}
	.layer_content {margin: 10px;background: #fff;padding: 10px;overflow: hidden;}
	.layer_form{overflow: hidden; position: relative; height:60px;transition: height 2s;-moz-transition: height 2s; /* Firefox 4 */-webkit-transition: height 2s; /* Safari 和 Chrome */-o-transition: height 2s; /* Opera */ }
	.layer_form.auto{ height: auto;}
	.layer_form .down_icon{ position:absolute; right: 10px;top: 10px; width: 32px; height: 32px; border-radius: 5px; background:url(/public/images/down-icon.png) center center no-repeat; background-size: 20px 20px;transition:all 0.3s ease-in-out;-o-transition:all 0.3s ease-in-out;-webkit-transition:all 0.3s ease-in-out;-moztransition:all 0.3s ease-in-out;}
	.layer_form .down_icon.on{transform:rotate(180deg);}
	.layer_form .down_icon:hover{ background-color: #eee;}
	.button_content{ padding: 20px 0px; text-align: center;}
	.button_content button{ background:#7ba9fb; font-size: 14px; margin: 0px 10px; border: none; padding:0px 20px; height: 34px; line-height: 34px; color: #fff; border-radius: 3px;}
	.button_content .graybutton{ background: #fff; border:1px solid #ccc; color:#666; background: #fafafa;}
	.layer_tit,.layer_control {float: left;}
	.layer_div {padding: 10px 0px;float: left;}
	.layer_tit {display: inline-block;font-size: 14px;color: #666;width: 100px;text-align: right;height: 36px;line-height: 36px;vertical-align: middle;}
	.layer_control input[type="text"],
	.layer_control select {padding: 5px;height: 24px;line-height: 24px;border: 1px solid #dcdfe6;vertical-align: middle;color: #666;border-radius: 3px;}
	.layer_control input:hover,.layer_control select:hover{border:1px solid #ccc;}
	.button_content button:focus{ outline:none;}
	.button_content button:hover{ cursor: pointer; opacity: 0.9;}
	.layer_control input::placeholder {color: #aaa;}
	.layer_control input:focus,.layer_control select:focus{border: 1px solid #7ba9fb;}
	.button_search{ padding: 10px 0px; text-align: center;}
	.button_search button{ background:#7ba9fb; font-size: 14px; margin: 0px 10px; border: none; padding:0px 20px; height: 34px; line-height: 34px; color: #fff; border-radius: 3px;}
	.button_search .graybutton{ background: #fff; border:1px solid #ccc; color:#666; background: #fafafa;}
	.button_search button:focus{ outline:none;}
	.button_search button:hover{ cursor: pointer; opacity: 0.9;}
	.w180 {width: 180px;}

	a{
		cursor:pointer;color: #1f9fff;font-size: 12px;padding-right: 5px;padding-left: 5px;
	}

	/*.search-keywords{width: 410px;height: 35px;line-height:35px;}
	.layui-keywords{width: 100px;height:35px;float:left;text-align: right}
	.input-keywords{width: 300px;float:left;border: 1px solid white}
	.search {
		padding: 10px 10px;
	}
	.layui-elem-quote {
	    margin-bottom: 10px;
	    padding: 15px;
	    line-height: 22px;
	    border-left: 5px solid #009688;
	    border-radius: 0 2px 2px 0;
	    background-color: #f2f2f2;
	}

	blockquote, body, button, dd, div, dl, dt, form, h1, h2, h3, h4, h5, h6, input, li, ol, p, pre, td, textarea, th, ul {
	    margin: 0 ;
	    padding: 0;
	    -webkit-tap-highlight-color: rgba(0,0,0,0);
	}
	blockquote {
	    display: block;
	    -webkit-margin-before: 1em;
	    -webkit-margin-after: 1em;
	    -webkit-margin-start: 0px;
	    -webkit-margin-end: 40px;
	}
.layui-table-cell{width:40px;}
	.layui-layer-loading .layui-layer-content {

		width: 100% !important;
		position: relative;
		background: url(/public/images/loading-1.gif) center no-repeat !important;

	}
	.layui-layer-loading .layui-layer-content p{    position: absolute;
		left: 50%;
		top: 60%;
		margin-left: -92px;color:#fff;
	}*/
</style>
<body class="layui-layout-body" style="overflow: auto;">
<div class="layui-layout layui-layout-admin">
    <div style="padding: 15px;">
        <block name="content"><div id="iframepage"></div></block>
    </div>
</div>
</body>
	<script>
		//更改后台字段
	function admin_update(obj,table_name,table_field,table_id,id_value,encrypt){
		var new_obj = $(obj);
		layer.confirm('确定修改', function(index){
			var field_value = new_obj.prev('input').val();
			$.post('/admin/upload/edit',{'table_name':table_name,'table_field':table_field,'table_id':table_id,'id_value':id_value,'field_value':field_value},function(data){
				console.log(data)
				if(data.status == 1){
					layer.msg(data.msg,{icon: 1});
				}else{
					layer.msg(data.msg,{icon: 2});
				}
			},'json')
		  layer.close(index);
		});
	}
	function add_t(obj,title){
		var url = $(obj).data('url');
		var index = layui.layer.open({
			title : title,
			type : 2,
			content : url,
			success : function(layero, index){
				setTimeout(function(){
					layui.layer.tips('点击此处返回列表', '.layui-layer-setwin .layui-layer-close', {
						tips: 3,
						time:3000
					});
				},500)
			}
		});
		//改变窗口大小时，重置弹窗的高度，防止超出可视区域（如F12调出debug的操作）
		$(window).resize(function(){
			layui.layer.full(index);
		});
		layui.layer.full(index);
	}
    function table_r(tableIns) {
        if(_count==0){
            tableIns.reload({where:{}});
        }
        $(document).find(".layui-laypage-skip").children('.layui-input').val(_cur_page);
        $(document).find(".layui-laypage-btn").click();
    }
	// layer = parent.layer === undefined ? layui.layer : parent.layer,
	// layer.closeAll("iframe");

        //调整iframe高度
        function iFrameHeight() {
            var ifm = document.getElementById("iframepage");
            if (ifm != null) {
                ifm.height =  window.screen.availHeight;
            }
        }


        //加水印方法
        var mask_div = document.createElement('div');
        mask_div.id = 'mask_div1';
        mask_div.style.position = "absolute";
        mask_div.style.left =  '40px';
        mask_div.style.top =  '20px';
        mask_div.style.overflow = "hidden";
        mask_div.style.zIndex = "9999";
        mask_div.style.opacity = 0.1;
        document.body.appendChild(mask_div);

        /**
         * Html 添加水印
         */
        function watermark(settings) {

            //默认设置
            var defaultSettings={
                watermark_txt:"text",
                watermark_x:20,//水印起始位置x轴坐标
                watermark_y:20,//水印起始位置Y轴坐标
                watermark_rows:20,//水印行数
                watermark_cols:20,//水印列数
                watermark_x_space:120,//水印x轴间隔
                watermark_y_space:60,//水印y轴间隔
                watermark_color:'#000000',//水印字体颜色
                watermark_alpha:0.1,//水印透明度
                watermark_fontsize:'16px',//水印字体大小
                watermark_font:'微软雅黑',//水印字体
                watermark_width:55,//水印宽度
                watermark_height:20,//水印长度
                watermark_angle:15//水印倾斜度数
            };
            //采用配置项替换默认值，作用类似jquery.extend
            if(arguments.length===1&&typeof arguments[0] ==="object" )
            {
                var src=arguments[0]||{};
                for(key in src)
                {
                    if(src[key]&&defaultSettings[key]&&src[key]===defaultSettings[key])
                        continue;
                    else if(src[key])
                        defaultSettings[key]=src[key];
                }
            }

            var oTemp = document.createDocumentFragment();

            //获取页面最大宽度
            var page_width = Math.max(document.body.scrollWidth,document.body.clientWidth);
            //获取页面最大长度
            var page_height = Math.max(document.body.scrollHeight,document.body.clientHeight);
            if(page_height < 700) {
                page_height = 700;
			}

            //如果将水印列数设置为0，或水印列数设置过大，超过页面最大宽度，则重新计算水印列数和水印x轴间隔
            if (defaultSettings.watermark_cols == 0 || (parseInt(defaultSettings.watermark_x + defaultSettings.watermark_width *defaultSettings.watermark_cols + defaultSettings.watermark_x_space * (defaultSettings.watermark_cols - 1)) > page_width)) {
                defaultSettings.watermark_cols = parseInt((page_width-defaultSettings.watermark_x+defaultSettings.watermark_x_space) / (defaultSettings.watermark_width + defaultSettings.watermark_x_space));
                defaultSettings.watermark_x_space = parseInt((page_width - defaultSettings.watermark_x - defaultSettings.watermark_width * defaultSettings.watermark_cols) / (defaultSettings.watermark_cols - 1));
            }
            //如果将水印行数设置为0，或水印行数设置过大，超过页面最大长度，则重新计算水印行数和水印y轴间隔
            if (defaultSettings.watermark_rows == 0 || (parseInt(defaultSettings.watermark_y + defaultSettings.watermark_height * defaultSettings.watermark_rows + defaultSettings.watermark_y_space * (defaultSettings.watermark_rows - 1)) > page_height)) {
                defaultSettings.watermark_rows = parseInt((defaultSettings.watermark_y_space + page_height - defaultSettings.watermark_y) / (defaultSettings.watermark_height + defaultSettings.watermark_y_space));
                defaultSettings.watermark_y_space = parseInt(((page_height - defaultSettings.watermark_y) - defaultSettings.watermark_height * defaultSettings.watermark_rows) / (defaultSettings.watermark_rows - 1));
            }
            var x;
            var y;
            for (var i = 0; i < defaultSettings.watermark_rows; i++) {
                y = defaultSettings.watermark_y + (defaultSettings.watermark_y_space + defaultSettings.watermark_height) * i;
                for (var j = 0; j < defaultSettings.watermark_cols; j++) {
                    x = defaultSettings.watermark_x + (defaultSettings.watermark_width + defaultSettings.watermark_x_space) * j;

                    var mask_div = document.createElement('div');
                    mask_div.id = 'mask_div' + i + j;
                    mask_div.appendChild(document.createTextNode(defaultSettings.watermark_txt));
                    //设置水印div倾斜显示
                    mask_div.style.webkitTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
                    mask_div.style.MozTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
                    mask_div.style.msTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
                    mask_div.style.OTransform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
                    mask_div.style.transform = "rotate(-" + defaultSettings.watermark_angle + "deg)";
                    mask_div.style.visibility = "";
                    mask_div.style.position = "absolute";
                    mask_div.style.left = x + 'px';
                    mask_div.style.top = y + 'px';
                    mask_div.style.overflow = "hidden";
                    mask_div.style.zIndex = "9999";
                    //mask_div.style.border="solid #eee 1px";
                    mask_div.style.opacity = defaultSettings.watermark_alpha;
                    mask_div.style.fontSize = defaultSettings.watermark_fontsize;
                    mask_div.style.fontFamily = defaultSettings.watermark_font;
                    mask_div.style.color = defaultSettings.watermark_color;
                    mask_div.style.textAlign = "center";
                    mask_div.style.width = defaultSettings.watermark_width + 'px';
                    mask_div.style.height = defaultSettings.watermark_height + 'px';
                    mask_div.style.display = "block";
                    mask_div.style.pointerEvents = "none";
                    oTemp.appendChild(mask_div);
                };
            };
            document.body.appendChild(oTemp);
        }

        window.onload=function(){
            watermark({ watermark_txt: "{$admin_info.user_name}"});
        };

//		window.onresize = function () {
//			watermark({ watermark_txt: "测试",watermark_width:50 })
//		};

	</script>
</html>
                                                                                       
